//
//  ZH_ApplyRefundViewController.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/31.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_ApplyRefundViewController.h"
#import "ZH_RefundTopTableViewCell.h"
#import "ZH_RefundGoodsStateTableViewCell.h"
#import "ZH_RefundReasonTableViewCell.h"
#import "ZH_RefundMoneyTableViewCell.h"
#import "ZH_RefundTitleTableViewCell.h"
#import "QL_SSLoadImageTableViewCell.h"
@interface ZH_ApplyRefundViewController ()<UITableViewDelegate,UITableViewDataSource>
//tableView
@property (nonatomic,weak)UITableView *tableView;
@property (nonatomic,weak)UIButton *bottomButton;
@end

@implementation ZH_ApplyRefundViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUserInterface];
}

- (void)initUserInterface{
    self.navigationItem.title = @"申请退款";
    [self.bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self.view);
        make.height.mas_equalTo(FITSCALE(50));
    }];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(FITSCALE(9));
        make.left.equalTo(self.view).offset(FITSCALE(12));
        make.right.equalTo(self.view).offset(FITSCALE(-12));
        make.bottom.equalTo(self.bottomButton.mas_top);
    }];
}
#pragma mark - UITableViewDelegate,UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 1) {
        return 6;
    }
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 1) {
        return FITSCALE(9);
    }
    return CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return CGFLOAT_MIN;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        ZH_RefundTopTableViewCell *cell = [ZH_RefundTopTableViewCell cellWithTableView:tableView];
        return cell;
    }
    else if (indexPath.section == 1){
        if (indexPath.row == 0) {
            ZH_RefundGoodsStateTableViewCell *cell = [ZH_RefundGoodsStateTableViewCell cellWithTableView:tableView];
            return cell;
        }
        else if (indexPath.row == 1){
            ZH_RefundReasonTableViewCell *cell = [ZH_RefundReasonTableViewCell cellWithTableView:tableView];
            return cell;
        }
        else if (indexPath.row == 2){
            ZH_RefundReasonTableViewCell *cell = [ZH_RefundReasonTableViewCell cellWithTableView:tableView];
            return cell;
        }
        else if (indexPath.row == 3){
            ZH_RefundMoneyTableViewCell *cell = [ZH_RefundMoneyTableViewCell cellWithTableView:tableView];
            return cell;
        }
        else if (indexPath.row == 4){
            ZH_RefundTitleTableViewCell *cell = [ZH_RefundTitleTableViewCell cellWithTableView:tableView];
            return cell;
        }
        else if (indexPath.row == 5){
            QL_SSLoadImageTableViewCell *cell = [QL_SSLoadImageTableViewCell cellWithTableView:tableView];
            return cell;
        }
    }
    return nil;
}
#pragma mark - getter,setter
- (UIButton *)bottomButton{
    if (!_bottomButton) {
        UIButton *button = [UIButton createNoBgButtonWithTitle:@"提交" target:self action:nil];
        button.backgroundColor = [UIColor colorWithHexString:@"#CEECE8"];
        [button setTitleColor:[UIColor colorWithHexString:@"#00C9AE"] forState:UIControlStateNormal];
        button.titleLabel.font = kFontSize_34;
        [self.view addSubview:_bottomButton = button];
    }
    return _bottomButton;
}
- (UITableView *)tableView{
    if (!_tableView) {
        UITableView *tableView = [UITableView createTableViewWithDelegateTarget:self];
        tableView.backgroundColor = kCommonBackgroudColor;
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [tableView setCellAutoAdaptationForEstimatedRowHeight:FITSCALE(100)];
        [self.view addSubview:_tableView = tableView];
    }
    return _tableView;
}

@end
